import { CHANGE_IDENTITY, TOKEN, REMOVE_TOKEN, CENTER_LIST, SAVE_BOX, SAVE_MSG_AVATAR, SAVE_CHATTING, SAVE_NAME, REMOVE_CHAT } from "./action-type";

export const changeNameAction = (title) => {
    return {
        type: CHANGE_IDENTITY,
        title
    }
}

export const saveToken = (token) => {
    return {
        type: TOKEN,
        token
    }
}

export const removeToken = () => {
    return {
        type: REMOVE_TOKEN,
        token: ''
    }
}

export const getList = (list) => {
    return {
        type: CENTER_LIST,
        list
    }
}

export const saveBox = (box) => {
    return {
        type: SAVE_BOX,
        box
    }
}

export const saveMsgAvatar = (avatar) => {
    return {
        type: SAVE_MSG_AVATAR,
        avatar
    }
}

export const saveChatting = (chatObj) => {
    return {
        type: SAVE_CHATTING,
        chatObj
    }
}

export const saveName = (name) => {
    return {
        type: SAVE_NAME,
        name
    }
}

export const removeChat = () => {
    return {
        type: REMOVE_CHAT,
        chatObj: []
    }
}